﻿using System;

namespace Lingo
{
    class Player
    {
        public string Name { get; set; }
        
        public Player(string name)
        {
            this.Name = name;
        }

        public Word Guess(string guess)
        {
            Word result = new Word(guess);

            for (int i = 0; i < guess.Length; i++)
            {
                if (guess[i].Equals(Lingo.CurrentRound.Word.Letters[i].Character))
                    result.Letters[i].State = LetterState.Correct;
                else if (Lingo.CurrentRound.Word.Solution.Contains(guess[i].ToString()))
                    result.Letters[i].State = LetterState.Present;
                else
                    result.Letters[i].State = LetterState.Blank;
            }
            Lingo.CurrentRound.Guesses++;

            return result;
        }
    }
}
